/*
  Copyright 1996-2003
  Simon Whiteside

*/
package simkin.examples.helloworld;
import simkin.*;
import java.io.StringBufferInputStream;

/**
 * This class shows the simplest possible application which just prints "Hello World"
 */

public class HelloWorld {

    /* A simple piece of XML, that just shows "Hello World" on the console:

       <object>
        <function name="main">
	trace("Hello World");
	</function>
       </object>
    */
    static String g_XML="<object><function name=\"main\"> trace(\"Hello World\"); </function></object>";

    static public void main(String[] args){
	try{
	    // Create an interpreter and a context
	    Interpreter interp=new Interpreter();
	    ExecutableContext ctxt=new ExecutableContext(interp);

	    // create an XMLExecutable object with the xml string
	    XMLExecutable executable=new XMLExecutable("",new StringBufferInputStream(g_XML));

	    // call the "main" method
	    executable.method("main",null,ctxt);
	}catch(Exception e){
	    e.printStackTrace();
	}
    }
}
